Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

342
Views
No se puede crear un componente con montaje superficial, vm.$refs['VTU_COMPONENT'] no está definido

No estoy seguro si es un error o si estoy haciendo algo mal.

Intento montar el componente principal de mi aplicación con el shallowMount pero no funciona. Recibo el siguiente mensaje de error:

No se pueden establecer propiedades de indefinido (estableciendo 'hasOwnProperty')

Ocurre cuando vue-test-utils intenta montar el componente de la aplicación:

 ... var appRef = vm.$refs[MOUNT_COMPONENT_REF]; // we add `hasOwnProperty` so jest can spy on the proxied vm without throwing appRef.hasOwnProperty = function (property) { return Reflect.has(appRef, property); }; console.warn = warnSave; var wrapper = createVueWrapper(app, appRef, setProps); trackInstance(wrapper); return wrapper; ...

Aquí, MOUNT_COMPONENT_REF es igual a 'VTU_COMPONENT' y vm.$refs[MOUNT_COMPONENT_REF] no está definido.

Ejemplo mínimo

Está disponible en línea: https://codesandbox.io/s/prod-glitter-tnoyqt?file=/src/App.spec.js

aplicación.vue

 <template> <div id="a-test"> {{ test }} </div> </template> <script> export default { name: "App", }; </script>

Aplicación.spec.js

 import { shallowMount } from "@vue/test-utils"; import App from "@/App"; describe("App.vue", () => { test("Test that fails", async () => { const wrapper = shallowMount(App); }); });
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

arreglado si actualizo a @vue/test-utils 2.0.0-rc.21

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!